<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>Generator</title>
</head>
<body>
<script>
function takeLongTime(n) {
    console.log('n', n);
    return n * 2;
}
function* test02() {
    let result01 = yield takeLongTime(11);// 第1次next到此为止
    console.log('result01', result01);//result01 8
    let result02 = yield takeLongTime(12);// 第2次next到此为止
    console.log('result02', result02);//result02 7
    let result03 = yield takeLongTime(13);// 第3次next到此为止
    console.log('result03', result03);// 第4次next到此为止,并标示done为true
}
var testObj02 = test02();//代码并没有被执行,没有输出11
console.log('------------');
console.log(testObj02.next(9));
console.log('------------');
console.log(testObj02.next(8));
console.log('------------');
console.log(testObj02.next(7));
console.log('------------');
console.log(testObj02.next(6));
console.log('------------');
console.log('end');
</script>
</body>
</html>